from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_deepseek import ChatDeepSeek

model = ChatDeepSeek(
    model="deepseek-chat",
    temperature=0,
    max_tokens=None,
    timeout=None,
    max_retries=2,
    api_key="sk-85fc9df9a1a9474fbba2f9291ed57476",
)
prompt = ChatPromptTemplate.from_template("请给我讲个关于 {topic} 的简短笑话")
output_parser = StrOutputParser()
chain = prompt | model | output_parser
print(chain.invoke({"topic": "冰淇淋"}))
